package com.one.service;

import com.one.annotation.RequestPermission;
import com.one.annotation.RequestUser;
import com.one.bean.ConsigneeInfo;
import com.one.bean.User;
import com.one.util.RequestReturn;
import com.one.util.RequestReturnFactory;
import com.one.vo.UpUserVo;
import com.one.vo.UserVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author ShiWen
 * @date 2022/1/19 18:36
 * @Version 1.0
 * @Description TODO 用户信息服务
 */
@FeignClient(name = "street-userinfo")
public interface UserInfoService {
    /**
     * @description 查询用户信息
     * @author ShiWen
     * @date 2022/1/19 9:45
     */
    @GetMapping("/getUser")
    RequestReturn<UserVo> queryUser();

    /**
     * @description 修改密码
     * @author ShiWen
     * @date 2022/1/19 10:11
     */
    @PostMapping("/updatePwd")
    RequestReturn<String> updatePwd(@RequestParam("phone") String phone, @RequestParam("newPwd") String newPwd,@RequestParam("auth") String auth);

    /**
     * @description 修改个人信息
     * @author ShiWen
     * @date 2022/1/19 13:48
     */
    @PostMapping("/updateUserInfo")
    RequestReturn<String> updatePwd(@RequestBody UpUserVo user);

    /**
     * @description 添加个人收货信息
     * @author ShiWen
     * @date 2022/1/19 14:26
     */
    @PostMapping("/insertConsignee")
    RequestReturn<String> insertConsignee(@RequestBody ConsigneeInfo consigneeInfo);

    /**
     * @description 删除地址信息
     * @author ShiWen
     * @date 2022/1/19 15:13
     */
    @PostMapping("/delConsignee")
    RequestReturn<String> delConsigneeById(@RequestParam("consigneeId") Integer consigneeId);
    /**
     * @description 设置地址为默认
     * @author ShiWen
     * @date 2022/1/19 15:24
     */
    @RequestPermission
    @GetMapping("/setDefault")
    RequestReturn<String> setDefaultAddress(@RequestParam("consigneeId") Integer consigneeId);

    /**
     * @description 查询用户的所有收货地址
     * @author ShiWen
     * @date 2022/1/19 16:04
     */
    @GetMapping("/queryConsignee")
    RequestReturn<List<ConsigneeInfo>> queryConsignee();
    /**
     * @description 查询用户默认收货地址
     * @author ShiWen
     * @date 2022/1/19 16:04
     */
    @GetMapping("/defaultConsignee")
    RequestReturn<ConsigneeInfo> defaultConsignee();
}
